package fx.mine.active.component;

import javafx.collections.ObservableList;
import javafx.scene.Node;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
import lombok.extern.log4j.Log4j2;

@Log4j2
public class MainContainer extends AnchorPane {

    public MainContainer(Stage stage) {
        setId("rootPane");
        setPrefSize(1280, 720);

        addTitleBar(stage);
        addMainScene();
        addSideBar();

        getStyleClass().add("rootPane");
        getStylesheets().add(
                getClass().getResource("/css/main.css").toExternalForm()
        );
    }

    private void addMainScene() {
        ObservableList<Node> children = getChildren();
        var mainScene = new MainScene();
        children.add(mainScene);
    }

    private void addSideBar() {
        ObservableList<Node> children = getChildren();
        var sidebar = new SideBar();
        children.add(sidebar);
    }

    private void addTitleBar(Stage stage) {
        ObservableList<Node> children = getChildren();
        var titleBar = new TitleBar(stage);
        children.add(titleBar);
    }


}
